import App from "./App";
import bootstrap from "./core/bootstrap";
// Api函数polyfill（目前为实验版本，如不需要，可删除！）';
import Polyfill from "./polyfill/polyfill";
Polyfill.init();
// 全局mixins，用于实现setData等功能，请勿删除！';
import Mixin from "./polyfill/mixins";
import aggregatePay from "@/mixins/aggregatePay";

import messages, { langEnum } from "./common/lang/index";

let i18nConfig = {
  // locale:localStorage.getItem('getLangSetting') ||  "zhHans",
  locale:"zhHans",
  messages,
};
let type = uni.getStorageSync("lang")
console.log(type,'typetype')
if(type != ''){
	i18nConfig.locale = type
	i18nConfig.messages={
		[type]:uni.getStorageSync('langData')
	}
  }
  
  console.log(i18nConfig)


// #ifndef VUE3
import Vue from "vue";
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
const i18n = new VueI18n(i18nConfig);
Vue.prototype.$i18nn = i18n;


Vue.mixin(Mixin);
Vue.mixin(aggregatePay);
Vue.config.productionTip = false;

App.mpType = "app";
const app = new Vue({
  i18n,
  ...App,
});
app.$mount();
wx.$vm = app
// #endif

// #ifdef VUE3
import { createSSRApp } from "vue";
import { createI18n } from "vue-i18n";
const i18nSSR = createI18n(i18nConfig);
export function createApp() {
  const app = createSSRApp(App);
  app.mixin(Mixin);
  app.mixin(aggregatePay);
  app.use(i18nSSR);
  return {
    app,
  };
}
// #endif
